package Bean;

import java.text.SimpleDateFormat;
import java.util.Date;

import com.alibaba.fastjson.JSONObject;



public class BeanBook implements Comparable{
	String book_id;
	String title;
	String author;
	String publisher;
	int publishing_time;
	float book_price;
	int category_id;
	int inventory;
	String description;
	String url;
	float score;
	
	public float getScore() {
		return score;
	}
	public void setScore(float score) {
		this.score = score;
	}
	public String getUrl() {
		return url;
	}
	public void setUrl(String url) {
		this.url = url;
	}
	public String getTitle() {
		return title;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	public String getAuthor() {
		return author;
	}
	public void setAuthor(String author) {
		this.author = author;
	}
	public String getPublisher() {
		return publisher;
	}
	public void setPublisher(String publisher) {
		this.publisher = publisher;
	}

	public float getBook_price() {
		return book_price;
	}
	public void setBook_price(float book_price) {
		this.book_price = book_price;
	}
	public int getCategory_id() {
		return category_id;
	}
	public void setCategory_id(int category_id) {
		this.category_id = category_id;
	}
	public int getInventory() {
		return inventory;
	}
	public void setInventory(int inventory) {
		this.inventory = inventory;
	}
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}
	
	public String getBook_id() {
		return book_id;
	}
	public void setBook_id(String book_id) {
		this.book_id = book_id;
	}
	public int getPublishing_time() {
		return publishing_time;
	}
	public void setPublishing_time(int publishing_time) {
		this.publishing_time = publishing_time;
	}
	@Override
	public int compareTo(Object o) {
		// TODO Auto-generated method stub
		BeanBook n = (BeanBook) o;
		if(score>n.score)return 1;
		if(score<n.score)return -1;
        return 0;
	}
	public JSONObject toJson() {
		JSONObject j=new JSONObject();
		j.put("book_id", book_id);
		j.put("title", title);
		j.put("author", author);
		j.put("publisher", publisher);
		j.put("publishing_time", publishing_time);
		j.put("book_price", book_price);
		j.put("category_id", category_id);
		j.put("inventory", inventory);
		j.put("description", description);
		j.put("url", url);
		j.put("score", score);
		return j;
	}
}
